﻿using Microsoft.EntityFrameworkCore;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using TyNetCoreBlog.Helpers;
using TyNetCoreBlog.Models.Entities;

namespace TyNetCoreBlog.Models.Data
{
    public static class ModelBuildreExtrnsion
    {
        public static void SeedData(this ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<User>().HasData(
                new User
                {
                    Id = 1,
                    UserName = "tingyu",
                    Password = Md5Encrypt.GetMd5Str("tingyu131711&"),
                    Nickname = "※听雨※",
                    QQ = "1186472484",
                    Email = "1186472484@qq.com",
                    Motto = "90后业余编程爱好者",
                    PersonalProfile = "没啥好介绍的"
                }
            );

            modelBuilder.Entity<Category>().HasData(
                new Category
                {
                    Id = 1,
                    Name = "C#",
                    Sort = 1
                },
                new Category
                {
                    Id = 2,
                    Name = "Linux",
                    Sort = 1
                }
            );


            modelBuilder.Entity<Tag>().HasData(
                new Tag
                {
                    Id = 1,
                    Name = "winform",
                },
                new Tag
                {
                    Id = 2,
                    Name = ".net core",
                },
                new Tag
                {
                    Id = 3,
                    Name = "elementary os",
                }
            );
        }

    }
}
